965f83d4eba41d8e85452b74a750925905c4ce02,clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceTransitions.java,ServiceTransitions,enableTransitionChain,#ServiceConfiguration#,126
Before Change
}
static final CheckedListenableFuture<ServiceConfiguration> enableTransitionChain( final ServiceConfiguration config ) {
Callable<CheckedListenableFuture<ServiceConfiguration>> transition = null;
switch ( config.lookupStateMachine( ).getState( ) ) {
case ENABLED:
break;
case NOTREADY:
case DISABLED:
transition = Automata.sequenceTransitions( config, Component.State.DISABLED, Component.State.ENABLED );
break;
case LOADED:
case STOPPED:
transition = Automata.sequenceTransitions( config, Component.State.LOADED, Component.State.NOTREADY, Component.State.DISABLED,
Component.State.ENABLED );
break;
case INITIALIZED:
transition = Automata.sequenceTransitions( config, Component.State.INITIALIZED, Component.State.LOADED, Component.State.NOTREADY,
Component.State.DISABLED, Component.State.ENABLED );
break;
default:
throw new IllegalStateException( "Failed to find transition for current component state: " + config.lookupComponent( ).toString( ) );
}
CheckedListenableFuture<ServiceConfiguration> transitionResult = null;
try {
transitionResult = Threads.lookup( Empyrean.class ).submit( transition ).get( );
} catch ( InterruptedException ex ) {
LOG.error( ex, ex );
transitionResult = Futures.predestinedFailedFuture( ex );
After Change
if ( !State.ENABLED.equals( config.lookupState( ) ) ) {
CheckedListenableFuture<ServiceConfiguration> transitionResult = null;
try {
Callable<CheckedListenableFuture<ServiceConfiguration>> transition = Automata.sequenceTransitions( config, Component.State.PRIMORDIAL,
Component.State.INITIALIZED, Component.State.LOADED,
Component.State.NOTREADY,
Component.State.DISABLED, Component.State.ENABLED );
Future<CheckedListenableFuture<ServiceConfiguration>> result = Threads.lookup( Empyrean.class ).submit( transition );
transitionResult = result.get( );
} catch ( InterruptedException ex ) {
LOG.error( ex, ex );